#include "utils.h"

#include "CImage.h"

#include <cmath>

/*----------------------------------------------------------------------------*/


CImage::CImage( const DoubleV& _data, int _resultSize, int _activeOut )
	:	m_activeOut( _activeOut )
	,	m_data( _data )
{
	m_result.resize( _resultSize, 0.0 );
	m_result[ m_activeOut ] = 1.0;
}


/*----------------------------------------------------------------------------*/


CImage::~CImage()
{
}


/*----------------------------------------------------------------------------*/


const DoubleV& CImage::GetData() const
{
	return m_data;
}


/*----------------------------------------------------------------------------*/


const DoubleV& CImage::GetResult() const
{
	return m_result;
}


/*----------------------------------------------------------------------------*/


void CImage::PrintResultArray()
{
	printf("\n> CImage: Result array:");
	for( size_t i = 0; i < m_result.size(); i++ )
	{
		printf("\n> Out%d: %f", i, m_result[i]);
	}
}


/*----------------------------------------------------------------------------*/


void CImage::PrintData()
{
	FILE* pf = fopen( "out.txt", "a");
	for( int i = 0; i < 128; i++ )
	{
		fprintf( pf, "\n" );
		for ( int j = 0; j < 128; j++)
		{
			if ( m_data[i*128+j] == 0.0)
				fprintf( pf, " " );
			else
				fprintf( pf, "#" );
		}		
	}
	fclose( pf );
}


/*----------------------------------------------------------------------------*/

